
function Reg() {
    const submit = (e) => {

        const {username,password,mobile}=e.target.elements;

        console.log(username.value);
        console.log(password.value);
        console.log(mobile.value);

        //阻止默认事件
        e.preventDefault();
       
    }
    return (
        <form action="aaaa" onSubmit={(e)=>submit(e)}>
            <div className='reg-body'>
                <h1>注册</h1>
                <div>账号 <input name="username"></input></div>
                <div>密码 <input name="password"></input></div>
                <div>手机号 <input name="mobile"></input></div>
                <div><button type="submit">注册</button></div>
            </div>
        </form>
    )
}
export default Reg;